package com.tinyseed.emcp.api.app.common;

/**
 * 数据字典
 */
public class DicConstant {

    /**
     * 预警等级：1黄色预警，2橙色预警，3红色预警
     */

    public static final String LEVEL_YELLOW_CODE = "1";
    public static final String LEVEL_ORANGE_CODE = "2";
    public static final String LEVEL_RED_CODE = "3";
    public static final String LEVEL_YELLOW_STRING = "黄色预警";
    public static final String LEVEL_ORANGE_STRING = "橙色预警";
    public static final String LEVEL_RED_STRING = "红色预警";

    /**
     * 类型，0：限产，1：停产
     */

    public static final String PRODUCE_LIMIT_CODE = "0";
    public static final String PRODUCE_STOP_CODE = "1";
    public static final String PRODUCE_LIMIT_STRING = "限产";
    public static final String PRODUCE_STOP_STRING = "停产";
    /**
     * 启用 禁用，0：启用，1：禁用
     */

    public static final String PRODUCE_ENABLE_CODE = "0";
    public static final String PRODUCE_DISABLE_CODE = "1";
    public static final String PRODUCE_ENABLE_STRING = "启用";
    public static final String PRODUCE_DISABLE_STRING = "禁用";

    /**
     * 预警等级formatter
     *
     * @param l
     * @return
     */
    public static String formatterLevel(Long l) {
        if (l == null) {
            return "";
        }
        if (l.toString().equals(DicConstant.LEVEL_YELLOW_CODE)) {
            return DicConstant.LEVEL_YELLOW_STRING;
        }
        if (l.toString().equals(DicConstant.LEVEL_ORANGE_CODE)) {
            return DicConstant.LEVEL_ORANGE_STRING;
        }
        if (l.toString().equals(DicConstant.LEVEL_RED_CODE)) {
            return DicConstant.LEVEL_RED_STRING;
        }
        return "";
    }

    /**
     * 格式化生产类型
     *
     * @param s
     * @return
     */
    public static String formatterProduceType(Long l) {
        if (l.toString().equals(DicConstant.PRODUCE_LIMIT_CODE)) {
            return DicConstant.PRODUCE_LIMIT_STRING;
        }
        if (l.toString().equals(DicConstant.PRODUCE_STOP_CODE)) {
            return DicConstant.PRODUCE_STOP_STRING;
        }
        return "";
    }

    /**
     * 禁用 启用
     *
     * @param l
     * @return
     */
    public static String formatterEnable(Long l) {
        if (l.toString().equals(DicConstant.PRODUCE_ENABLE_CODE)) {
            return DicConstant.PRODUCE_ENABLE_STRING;
        }
        if (l.toString().equals(DicConstant.PRODUCE_DISABLE_CODE)) {
            return DicConstant.PRODUCE_DISABLE_STRING;
        }
        return "";
    }

}
